package com.um.jdy.app.activity.entity.dto;

import com.um.jdy.common.shop.enums.CouponsEnum;
import com.um.springboot.starter.entity.dto.PageQuery;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import org.checkerframework.checker.units.qual.C;

/**
 * @Title
 * @Description
 * @Author renjunwei
 * @Date 2023/2/16 14:09
 */
@Data
public class MyCouponsPageDTO extends PageQuery {

    @ApiModelProperty(value = "优惠券状态，null表示全部")
    private Status status;

    @ApiModelProperty(value = "优惠券类型，null表示全部")
    private CouponsEnum.Type type;

    @Getter
    @AllArgsConstructor
    public enum Status{

        Unused(" and cu.is_use = 'No' and DATE_FORMAT(c.start_time,'%Y-%m-%d') <= DATE_FORMAT(now(),'%Y-%m-%d') and DATE_FORMAT(c.end_time,'%Y-%m-%d') >= DATE_FORMAT(now(),'%Y-%m-%d') "),
        Used(" and cu.is_use = 'Yes' "),
        Unavailable(" and cu.is_use = 'No' and DATE_FORMAT(c.end_time,'%Y-%m-%d') < DATE_FORMAT(now(),'%Y-%m-%d') ")
        ;

        private String sql;

    }
}
